from django.views.generic import ListView, DetailView
from .models import PersonInfo
class PersonListView(ListView):
    model = PersonInfo
    template_name = 'person_list.html'
class PersonDetailView(DetailView):
    model = PersonInfo
    template_name = 'person_detail.html'

from django.views.generic.edit import FormView
from django import forms
from .models import PersonInfo
class PersonForm(forms.ModelForm):
    class Meta:
        model = PersonInfo
        fields = ['name', 'age', 'hireDate']
class PersonCreateView(FormView):
    template_name = 'person_form.html'
    form_class = PersonForm
    success_url = '/'
    def form_valid(self, form):
        form.save()
        return super().form_valid(form)

from django.views.generic.edit import CreateView
class PersonCreate(CreateView):
    model = PersonInfo
    form_class = PersonForm
    template_name = 'person_form.html'
    success_url = '/'

from django.views.generic.edit import UpdateView
class PersonUpdate(UpdateView):
    model = PersonInfo
    form_class = PersonForm
    template_name = 'person_form.html'
    success_url = '/'

from django.views.generic.edit import DeleteView
from django.urls import reverse_lazy
class PersonDelete(DeleteView):
    model = PersonInfo
    template_name = 'person_confirm_delete.html'
    success_url = reverse_lazy('person_list')

from django.views.generic.dates import MonthArchiveView, WeekArchiveView
class PersonMonthArchiveView(MonthArchiveView):
    model = PersonInfo
    date_field = 'hireDate'
    template_name = 'person_archive_month.html'
class PersonWeekArchiveView(WeekArchiveView):
    model = PersonInfo
    date_field = 'hireDate'
    template_name = 'person_archive_week.html'